//
//  DorpView.m
//  CooperLinker
//
//  Created by 张 晓军 on 16/4/13.
//  Copyright © 2016年 洪雯. All rights reserved.
//

#import "DorpView.h"
#define WINSIZE [[UIScreen mainScreen] bounds]
@interface DorpView ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView *_tabV;
}

@end

@implementation DorpView



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor groupTableViewBackgroundColor];
        _tabV = [[UITableView alloc] initWithFrame:CGRectMake(0, 0,WINSIZE.size.width , 0)];
        _tabV.backgroundColor = [UIColor whiteColor];
        _tabV.delegate = self;
        _tabV.dataSource = self;
        [self addSubview:_tabV];
    }
    return self;
}

- (void)starAnnotion {
    self.frame = CGRectMake(0, 62, WINSIZE.size.width, WINSIZE.size.height);
    self.backgroundColor = [[UIColor groupTableViewBackgroundColor]colorWithAlphaComponent:0.4];
    [UIView animateWithDuration:0.5 animations:^{
        
        _tabV.frame = CGRectMake(0, 0, WINSIZE.size.width, 50*5);
    }];
}

- (void)stopAnnotion {
    [UIView animateWithDuration:0.5 animations:^{
        _tabV.frame = CGRectMake(0, 0, WINSIZE.size.width, 0);
    } completion:^(BOOL finished) {
        [_tabV removeFromSuperview];
        [self removeFromSuperview];
    }];
}


#pragma 代理
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DorpID"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DorpID"];
    }
    NSArray *arryInfo = @[@"景区",@"服务区",@"厕所",@"医务室",@"屯警点"];
    cell.textLabel.text = arryInfo[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [self.screenDelaget ChooseDelaget:indexPath.row];
    
    
}


@end
